package hlhj.fhp.supreme.activitys

import android.content.pm.ActivityInfo
import android.os.Build
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.annotation.RequiresApi
import android.transition.Explode
import cn.jzvd.JZVideoPlayer
import com.bumptech.glide.Glide
import hlhj.fhp.supreme.BaseAty
import hlhj.fhp.supreme.R
import kotlinx.android.synthetic.main.activity_video_pre_view_aty.*

class VideoPreViewAty : BaseAty() {
    override fun getContentId(): Int = R.layout.activity_video_pre_view_aty

    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    override fun initView() {
        window.enterTransition= Explode().setDuration(800)
        window.returnTransition= Explode().setDuration(800)
        window.exitTransition= Explode().setDuration(800)


        videoPlayer.setUp(intent.getStringExtra("video"),JZVideoPlayer.SCREEN_WINDOW_NORMAL,"")
//        JZVideoPlayer.setMediaInterface()
        Glide.with(this).load(intent.getStringExtra("img")).asBitmap().into(videoPlayer.thumbImageView)
        JZVideoPlayer.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        JZVideoPlayer.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT

    }

    override fun onPause() {
        super.onPause()
        JZVideoPlayer.releaseAllVideos()

    }
    override fun onBackPressed() {
        if (JZVideoPlayer.backPress()) {
            return;
        }
        super.onBackPressed()
    }
}
